home *** CD-ROM | disk | FTP | other *** search
- head 1.5;
- branch ;
- access ;
- symbols sprited:1.5.1;
- locks ; strict;
- comment @ * @;
-
-
- 1.5
- date 88.07.29.17.08.24; author ouster; state Exp;
- branches 1.5.1.1;
- next 1.4;
-
- 1.4
- date 88.07.25.11.15.19; author ouster; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.07.01.14.01.51; author ouster; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.06.21.11.16.05; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.06.19.14.29.12; author ouster; state Exp;
- branches ;
- next ;
-
- 1.5.1.1
- date 91.12.08.17.05.02; author kupfer; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.5
- log
- @Lint.
- @
- text
- @/*
- * Fs_ReadVector.c --
- *
- * Source code for the Fs_ReadVector library procedure.
- *
- * Copyright 1988 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: Fs_ReadVector.c,v 1.4 88/07/25 11:15:19 ouster Exp $ SPRITE (Berkeley)";
- #endif not lint
-
- #include <sprite.h>
- #include <fs.h>
- #include <status.h>
- #include <stdlib.h>
-
- /*
- *----------------------------------------------------------------------
- *
- * Fs_ReadVector --
- *
- * The "normal" Fs_ReadVector routine for user code. Read from the file
- * indicated by the stream ID into the buffers described in vectorArray.
- * The vectorArray indicates how much data to read, and amtReadPtr
- * is an output parameter that indicates how much data were read.
- * A length of zero means end-of-file.
- *
- * Restarting from a signal is automatically handled by Fs_Read.
- *
- * Results:
- * Result from Fs_Read.
- *
- * Side effects:
- * See Fs_Read.
- *
- *----------------------------------------------------------------------
- */
-
- ReturnStatus
- Fs_ReadVector(streamID, numVectors, vectorArray, amtReadPtr)
- int streamID; /* The user's index into its open file list. */
- int numVectors; /* The # of vectors in userVectorArray. */
- Fs_IOVector vectorArray[]; /* The vectors defining where and how much to
- * read. */
- int *amtReadPtr; /* The amount of bytes actually read. */
- {
- register int i;
- register Fs_IOVector *vectorPtr;
- register int bufSize;
- Address buffer;
- Address ptr;
- ReturnStatus status;
-
- /*
- * Calculate the total number of bytes to be read.
- */
- bufSize = 0;
- for (i = 0, vectorPtr = vectorArray; i < numVectors; i++, vectorPtr++) {
- if (vectorPtr->bufSize < 0) {
- return SYS_INVALID_ARG;
- }
- bufSize += vectorPtr->bufSize;
- }
-
- buffer = (Address) malloc((unsigned) bufSize);
- status = Fs_Read(streamID, bufSize, buffer, amtReadPtr);
-
- if (status == SUCCESS) {
- register int copyAmount;
-
- bufSize = *amtReadPtr;
-
- /*
- * Copy the data to the individual buffers specified in the vectorArray.
- */
- ptr = buffer;
- for (i = 0, vectorPtr = vectorArray;
- (i < numVectors) && (bufSize > 0);
- i++, vectorPtr++) {
-
- if (bufSize < vectorPtr->bufSize) {
- copyAmount = bufSize;
- vectorPtr->bufSize = bufSize;
- } else {
- copyAmount = vectorPtr->bufSize;
- }
- bcopy(ptr, vectorPtr->buffer, copyAmount);
- ptr += copyAmount;
- bufSize -= copyAmount;
- }
- }
- free((char *) buffer);
- return(status);
- }
- @
-
-
- 1.5.1.1
- log
- @Initial branch for Sprite server.
- @
- text
- @d17 1
- a17 1
- static char rcsid[] = "$Header: /sprite/src/lib/c/syscall/RCS/Fs_ReadVector.c,v 1.5 88/07/29 17:08:24 ouster Exp $ SPRITE (Berkeley)";
- @
-
-
- 1.4
- log
- @Lint.
- @
- text
- @d17 1
- a17 1
- static char rcsid[] = "$Header: Fs_ReadVector.c,v 1.3 88/07/01 14:01:51 ouster Exp $ SPRITE (Berkeley)";
- d73 1
- a73 1
- buffer = (Address) malloc(bufSize);
- @
-
-
- 1.3
- log
- @Remove calls to Stat_Error: they aren't needed anymore.
- @
- text
- @d17 1
- a17 1
- static char rcsid[] = "$Header: Fs_ReadVector.c,v 1.2 88/06/21 11:16:05 ouster Exp $ SPRITE (Berkeley)";
- d23 1
- a23 7
-
- /*
- * Library imports:
- */
-
- extern char *malloc();
-
- @
-
-
- 1.2
- log
- @Need to include status.h
- @
- text
- @d17 1
- a17 1
- static char rcsid[] = "$Header: Fs_ReadVector.c,v 1.1 88/06/19 14:29:12 ouster Exp $ SPRITE (Berkeley)";
- d74 1
- a74 1
- return Stat_Error(SYS_INVALID_ARG);
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d17 1
- a17 1
- static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
- d22 1
- @
-